#pragma once

#include <map>
#include <iostream>

#include "kconfig.h"

typedef std::map<k_string, k_uint> lbltbl_t;

class LabelTable
{
private:
	lbltbl_t table;

public:
	void AddLabel(const k_string &ident, k_uint position, k_uint ln);
	void CleanUp();
	k_uint GetLabelPosition(const k_string &ident, k_uint ln) const;

#if _DEBUG
	void DumpLabels()
	{
		std::cout << "Labels:\n";
		std::map<k_string, k_uint>::iterator it = this->table.begin();
		for (; it != this->table.end(); ++it)
			std::cout << it->first << " : " << it->second << std::endl;
	}
#endif
};
